package com.tedu.bill;

/**
 * Author：毕龙
 * Date: 2024/3/25 16:29
 */
public class Test123 {
    public static void main(String[] args) {
        double pi = 0;
        int j = 0;
        int i = 1;
        while (true){
            pi = pi + (Math.pow(-1, j)*(4.0))/i ;
            if(pi  >=3.1415926 && pi <= 3.1415927){
                break;
            }
            i += 2;
            j ++;
        }
        System.out.println(j);
        /*double pow = Math.pow(-1, 0);
        double i = Math.pow(-1, 0)* 4/1;
        i = i + Math.pow(-1, 1)* 4/3;
        System.out.println(i);*/
    }
}
